
<table>
  <tr>
    <th>Rank</th>	 
    <th>Name</th>
	<th>Tag</th> 
	<th>Add</th> 
	<th>Score</th> 
	<th>Push</th> 
  </tr>
  
<% for blog in @blogs %>
  <tr>
  	<td><%= link_to_remote ( blog.rank,
                            :update => 'main',
                            :url => { :action => :show,:id => blog}) %>
    </td>
	<td><%= link_to_remote ( blog.name,
                            :update => 'main',
                            :url => { :action => :show,:id => blog }) %>
    </td>
	<%
	blogtag = Blogtag.find(:first,:order => "times DESC", :conditions => [ "blog_id = ?", blog.id])
    if blogtag==nil
    %>
	<td><%= link_to_remote ( "null",
                            :update => 'main',
                            :url => { :action => :show,:id => blog }) %>
    </td>
	<% else %>
	<td><%= link_to_remote ( h(blogtag.tag.name),
                            :update => 'main',
                            :url => { :action => :tag,:id => blogtag.tag.id }) %>
    </td>
	<% end %>
	<td>
  		<%= form_remote_tag(:update => "main", :url => { :action => :tagging } ) %> 
        <%= hidden_field_tag("blog",blog.id) %>
        <%= text_field_with_auto_complete :tag, :name, { :size => 16 }, {:tokens => ' '} %>
        <%= image_submit_tag "tag_button.gif" %>
        <%= end_form_tag %>
	</td>
	<td id=<%=blog.id%>>  <%=h blog.click %></td>
	<td><%= link_to_remote ( image_tag("push.gif",:border => 0),
                            :update => blog.id,
                            :url => { :action => :push,:id => blog.id }) %>
    </td>
  </tr>
<% end %>
</table>
<% if controller.action_name=="list" %>
<div id="paginate">
<%= link_to image_tag("previouspage.gif",:border => 0), { :page => @blog_pages.current.previous } if @blog_pages.current.previous %>
<%= link_to image_tag("nextpage.gif",:border => 0), { :page => @blog_pages.current.next } if @blog_pages.current.next %> 
</div>
<% end %>

